package com.xiaoyu.lanling.feature.gift.data

import com.xiaoyu.base.event.NoReceiverJsonEvent
import com.xiaoyu.base.net.RequestCreator
import com.xiaoyu.lanling.common.config.HttpConfig
import com.xiaoyu.lanling.event.gift.GetNotPlayedGiftAnimationEvent
import com.xiaoyu.lanling.event.gift.GiftListEvent
import com.xiaoyu.lanling.event.gift.GiveGiftAndSendMessageEvent

class GiftData {

    companion object {
        fun getGiftList(requestTag: Any, toUid: String, from: String) {
            RequestCreator.create<GiftListEvent>(requestTag, GiftListEvent::class.java)
                    .setRequestUrl(HttpConfig.LANLING_GET_GIFT_LIST)
                    .addPostData("toUid", toUid)
                    .addPostData("from", from)
                    .enqueue()
        }

        fun giveGift(requestTag: Any, toUid: String, productId: String, from: String) {
            RequestCreator.create<GiveGiftAndSendMessageEvent>(requestTag, GiveGiftAndSendMessageEvent::class.java)
                    .setRequestUrl(HttpConfig.LANLING_GIVE_GIFT)
                    .addQueryData("toUid", toUid)
                    .addQueryData("productId", productId)
                    .addQueryData("from", from)
                    .enqueue()
        }

        fun playGiftAnimation(billId: String) {
            RequestCreator.create<NoReceiverJsonEvent>(Any(), NoReceiverJsonEvent::class.java)
                    .setRequestUrl(HttpConfig.LANLING_PLAY_GIFT_ANIMATION)
                    .addQueryData("billId", billId)
                    .enqueue()
        }

        fun getNotPlayedGiftAnimation(requestTag: Any, fromUid: String) {
            RequestCreator.create<GetNotPlayedGiftAnimationEvent>(requestTag, GetNotPlayedGiftAnimationEvent::class.java)
                    .setRequestUrl(HttpConfig.LANLING_GET_NOT_PLAYED_GIFT_ANIMATION)
                    .addQueryData("fromUid", fromUid)
                    .enqueue()
        }
    }
}